import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.persistence.spi.PersistenceProvider;

import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;
import org.apache.openjpa.persistence.PersistenceProviderImpl;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter;

import com.szpxt.model.Privilege;
import com.szpxt.service.PrivilegeService;

public class Test {

	public static void main(String[] args) throws DocumentException {
		String[] conf = {"spring-core.xml", "spring-activiti.xml"};		
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(conf);
		RepositoryService repositoryService = (RepositoryService)context.getBean("repositoryService");
		RuntimeService runtimeService = (RuntimeService)context.getBean("runtimeService");
		
//		repositoryService.createDeployment().addClasspathResource("financing.bpmn20.xml").deploy();
		/*Map<String, Object> map = new HashMap<String, Object>();
		map.put("name", "张云");
		map.put("mobile", "1234567890");
		map.put("eMail", "abc@tom.com");
		map.put("amount", 10000.0d);
		map.put("userId", 1l);
		map.put("activitiId", "1");
		runtimeService.startProcessInstanceByKey("financing", map);*/
		
		ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().variableValueEquals("serialNumber", "201201138299720").singleResult();
	}
}
